package net.esj.auth.pojo;

import net.esj.basic.pojo.AbstractPojo;

public class CoreAuthLogger extends AbstractPojo<String> {
	
	public static final String SPLIT = ";";
	
	public static enum ResultType{
		AFTER_RETURN,THROW_EXCEPTION;
	}

	public static enum PersistType{
		DATABASE,FILE;
	}
	
	private String id;
	private String actionName;
	private ResultType resultType;
	private String exceptions;
	private String message;
	private PersistType persistType;
	private String adminClass;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getActionName() {
		return actionName;
	}
	public void setActionName(String actionName) {
		this.actionName = actionName;
	}
	public ResultType getResultType() {
		return resultType;
	}
	public void setResultType(String resultType) {
		this.resultType =ResultType.valueOf(resultType) ;
	}
	
	public Class[] getExceptions() throws ClassNotFoundException {
		String[] tmp = exceptions.split(SPLIT);
		Class[] clazzes = new Class[tmp.length];
		for(int i=0;i<tmp.length;i++){
			Class clazz = Class.forName(tmp[i]);
			clazzes[i] = clazz;
		}
		return clazzes;
	}
	public void setExceptions(String exceptions) {
		this.exceptions = exceptions;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public PersistType getPersistType() {
		return persistType;
	}
	public void setPersistType(String persistType) {
		this.persistType = PersistType.valueOf(persistType);
	}
	public void setAdminClass(String adminClass) {
		this.adminClass = adminClass;
	}
	public Class[] getAdminClass() throws ClassNotFoundException{
		String[] tmp = adminClass.split(SPLIT);
		Class[] clazzes = new Class[tmp.length];
		for(int i=0;i<tmp.length;i++){
			Class clazz = Class.forName(tmp[i]);
			clazzes[i] = clazz;
		}
		return clazzes;
	}
}
